﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace WingsOverSpace
{
    class lifeUp : WingsDrawableGameComponent
    {
        public Vector2 Velocity { get; set; }
        SpriteBatch spriteBatch;

        public lifeUp(Game g, Vector2 position, Vector2 velocity)
            : base(g)
        {
            Position = position;
            Velocity = velocity;
            SpriteScaleFactor = 0.15f;
            Visible = false;
        }

        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);
            Vector2 offset = new Vector2(sprite.Width / (2 * SpriteWidthDivFactor),
                sprite.Height / (2 * SpriteHeightDivFactor));

            spriteBatch.Begin();
            spriteBatch.Draw(sprite, boundBox, null, Color.White, 0f, 
                new Vector2(offset.X, offset.Y), SpriteEffects.None, 0);
            spriteBatch.End();
       }

        protected override void LoadContent()
        {
            sprite = Game.Content.Load<Texture2D>("extralife");
            spriteBatch = new SpriteBatch(Game.GraphicsDevice);
            base.LoadContent();
        }

        public override void Update(GameTime gameTime)
        {
           
            float elapsedSeconds = (float)gameTime.ElapsedGameTime.TotalSeconds;
            Position += Velocity * elapsedSeconds;

            base.Update(gameTime);
        }
    }

    class moneyPowerUp : WingsDrawableGameComponent
    {
        public Vector2 Velocity { get; set; }
        SpriteBatch spriteBatch;

        public moneyPowerUp(Game g, Vector2 position, Vector2 velocity)
            : base(g)
        {
            Position = position;
            Velocity = velocity;
            SpriteScaleFactor = 0.75f;
            Visible = false;
        }

        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);
            Vector2 offset = new Vector2(sprite.Width / (2 * SpriteWidthDivFactor),
                sprite.Height / (2 * SpriteHeightDivFactor));

            spriteBatch.Begin();
            spriteBatch.Draw(sprite, boundBox, null, Color.White, 0f, 
                new Vector2(offset.X, offset.Y), SpriteEffects.None, 0);
            /*
            spriteBatch.Draw(sprite, Position - offset, null, Color.White,
                0f, new Vector2(0, 0), SpriteScaleFactor, SpriteEffects.None, 0.05f);
            */
            spriteBatch.End();
        }

        protected override void LoadContent()
        {
            sprite = Game.Content.Load<Texture2D>("money");
            spriteBatch = new SpriteBatch(Game.GraphicsDevice);
            base.LoadContent();
        }

        public override void Update(GameTime gameTime)
        {
            float elapsedSeconds = (float)gameTime.ElapsedGameTime.TotalSeconds;
            Position += Velocity * elapsedSeconds;

            base.Update(gameTime);
        }
    }
}
